package mavenstudy;

import com.alibaba.fastjson.JSON;
import mavenstudy.dto.Flight;

import java.io.InputStream;
import java.util.List;
import java.util.Properties;

/**
 * ProjectName：mavenstudy
 * ClassName：Utils
 *
 * @author：hldiao
 * @date：16:17 2018/7/2
 */
public class Utils {
    public static List<Flight> queryFlights() {
        Properties properties = new Properties();
        InputStream in = Utils.class.getClassLoader().getResourceAsStream("Flight.properties");

        try{
            properties.load(in);
        }catch (Exception e){
            System.out.println(e);
        }
        String flights = properties.getProperty("flights");
        return JSON.parseArray(flights,Flight.class);
    }
}